<template>
  <view>
    sub component
    <view>{{ age }}</view>
    <view class=""> staticProp.value===={{ staticProp }} </view>
    <view class=""> title.value===={{ title }} </view>
    <view>like.value===={{ like }}</view>
    <view>is-published==={{ isPublished }}</view>
	<button type="primary" @click="onclick" style="display: flex; width: 75%; align-items: center; justify-content: center;"> 子组件传父组件值</button>
  </view>
</template>

<script>
  export default {
    data() {
      return {};
    },
    props: {
      staticProp: "",
      title: "",
      like: "",
      commentIds: {
        type: Array,
        default: () => [],
      },
      isPublished: false,
      age: {
        type: Number,
        default: 0,
        required: true,
        validator: function (value) {
          return value > 0;
        },
      },
      author: {
        type: Object,
        default: () => ({}),
      },
    },
    mounted() {
      console.log(this.isPublished);
      this.commentIds.forEach((id) => {
        console.log(id);
      });
      console.log(Object.keys(this.author));
    },
    methods: {
		onclick() {
			this.$emit('changeOfSub', this.title)
		}
	},
  };
</script>

<style>
  .content {
  }
</style>
